#include <iostream>
#include <string>

using namespace std;

int main() {
    string str { "hello" };
    for (int i{}; i < 20; i++) {
        // 超过长度取值为 NULL，并不会报错
        if (str[i] == NULL) cout << "s[" << i << "] = " << str[i] << "\n";
    }

    return 0;
}